package com.wyu.servlet;

import com.wyu.dao.CGDao;
import com.wyu.dao.CGDaoImpl;
import com.wyu.pojo.CG;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

@WebServlet("/CGServlet1")
public class CGServlet1 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        HttpSession session = request.getSession();

        CGDao dao = new CGDaoImpl();
        List<CG> list = dao.searchcg();
        session.setAttribute("cg",list);
        response.sendRedirect("cgxx1.jsp");
        request.getSession().setAttribute("Deletemessage","");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
